<?php
include_once 'common/common.function.php';
include_once 'common/database.class.php';
$db = new DataBase();

$sql = "select v.VerNo as VerNo,v.VerName as VerName,v.CreateTime as CreateTime,
COUNT(f.Id) as FileNum ,SUM(f.FileSize) as TotalSize 
from yabb_sys_ver as v left join yabb_sys_ver_file as f on v.VerNo=f.VerNo 
group by v.VerNo order by v.Id desc ";

$rows = $db->get_all($sql);

?> 

<form method="post">
<table>
<tr>
<th>VerNo</th>
<th>VerName</th>
<th>TotalSize</th>
<th>FileNum</th>
<th>CreateTime</th>
<th>Option</th>
</tr>

<?php foreach($rows as $key=>$val){?>
<tr>
<td><?php echo $val['VerNo'];?></td>
<td><?php echo $val['VerName'];?></td>
<td><?php echo format_file_bytes($val['TotalSize']);?></td>
<td><?php echo $val['FileNum'];?></td>
<td><?php echo date('Y-m-d H:i:s',$val['CreateTime']);?></td>

<td>
<a href="version_file.php?verno=<?php echo $val['VerNo'];?>">列出文件</a>
<a href="version_sync_ajax.php?verno=<?php echo $val['VerNo'];?>&step=0" >同步</a>
<a href="version_delete.php?verno=<?php echo $val['VerNo'];?>" onclick="return confirm('确定要删除吗');">删除</a>
</td>

</tr>
<?php }?>
</table>
</form>